package com.block.datapush.service.apipush.utils;

import cn.hutool.core.util.StrUtil;
import com.block.common.enums.BaseTypeInfoEnum;
import org.apache.commons.lang3.StringUtils;


/**
 * 好鑫花 双授权
 */
public class HaoXinHuaUtil {

    //性别
    public static Integer getSex(Integer sex) {
        if (sex == 1) {
            return 1;
        }
        return 0;
    }

    //芝麻分
    public static Integer getZhimaScore(String zhima) {
        if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm001.getValue(), zhima)) {
            return 1;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm002.getValue(), zhima)) {
            return 2;
        } else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm003.getValue(), zhima)) {
            return 3;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Zhima.zm004.getValue(), zhima)) {
            return 4;
        }
        return 5;
    }

    //公积金
    public static Integer getGjj(String gongjijin) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gjj.gjj001.getValue(), gongjijin)) {
            return 1;
        }
        return 2;
    }

    //社保
    public static Integer getSocialInsurance(String shebao) {
        if (StrUtil.equals(BaseTypeInfoEnum.Shebao.sb001.getValue(), shebao)) {
            return 1;
        }
        return 2;
    }

    //投保情况
    public static Integer getbaodan(String baodan) {
        if (StrUtil.equals(BaseTypeInfoEnum.Baoxian.bx001.getValue(), baodan)) {
            return 1;
        }
        return 2;
    }

    //房产情况
    public static Integer getHouse(String house) {
        if (StrUtil.equals(BaseTypeInfoEnum.House.hu001.getValue(), house)) {
            return 1;
        }
        return 2;
    }

    //车产情况
    public static Integer getCar(String car) {
        if (StrUtil.equals(BaseTypeInfoEnum.Car.car001.getValue(), car)) {
            return 1;
        }
        return 2;
    }

    //房产情况
    public static Integer getMortgageStatus(String house) {
        if (StrUtil.equals(BaseTypeInfoEnum.House.hu002.getValue(), house) || StrUtil.equals(BaseTypeInfoEnum.House.hu003.getValue(), house)) {
            return 2;
        }
        return 1;
    }

    //工作情况
    public static Integer getJob(String job) {
        if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz001.getValue(), job)) {
            return 1;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz004.getValue(), job)){
            return 2;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz002.getValue(), job)){
            return 3;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Gongzuo.gz003.getValue(), job)){
            return 4;
        }
        return 5;
    }

    public static Integer getloan(String loan) {
        if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la001.getValue(), loan)) {
            return 10000;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la002.getValue(), loan)) {
            return 30000;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la003.getValue(), loan)) {
            return 50000;
        } else if (StrUtil.equals(BaseTypeInfoEnum.LoanAmount.la004.getValue(), loan)) {
            return 100000;
        }
        return 200000;
    }

    public static String getIp(String ip){
        if (StringUtils.isNotEmpty(ip)){
            return ip;
        }
        return "127.0.0.1";
    }

    //收入
    public static Integer getShouru(String shouru) {
        if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr001.getValue(), shouru)) {
            return 1;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr002.getValue(), shouru)){
            return 3;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr003.getValue(), shouru)){
            return 4;
        }else if (StrUtil.equals(BaseTypeInfoEnum.Shouru.sr004.getValue(), shouru)){
            return 5;
        }
        return 2;
    }






}
